<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>学生添加</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <style type="text/css">
        .searchStudent{
            width: 80%;
            float: left;
            margin-right: 10px;
        }
    </style>
</head>
<body>

<form class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;" >

    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="stu_username" id="username"   placeholder="请输入学生用户名（默认为手机号码）" autocomplete="off" class="layui-input searchStudent">
            <button type="button" class="layui-btn layui-btn-normal" id="search"><i class="layui-icon layui-icon-search" style="font-size: 25px"></i></button>
        </div>
    </div>

    <hr style="margin-left: 36px">
    <div id="content">
        <!--<div id="contentItem">-->
            <!--<div class="layui-form-item">-->
                <!--<label class="layui-form-label">姓名学生</label>-->
                <!--<div class="layui-input-block">-->
                    <!--<input type="text" name="stu_realname"   autocomplete="off" class="layui-input">-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="layui-form-item">-->
                <!--<label class="layui-form-label">学生年级</label>-->
                <!--<div class="layui-input-block">-->
                    <!--<input type="text" name="stu_realname"   autocomplete="off" class="layui-input">-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="layui-form-item">-->
                <!--<label class="layui-form-label">学生学校</label>-->
                <!--<div class="layui-input-block">-->
                    <!--<input type="text" name="stu_realname"   autocomplete="off" class="layui-input">-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="layui-form-item">-->
                <!--<label class="layui-form-label">注册时间</label>-->
                <!--<div class="layui-input-block">-->
                    <!--<input type="text" name="stu_realname"   autocomplete="off" class="layui-input">-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->
    </div>


    <input type="hidden" name="stu_username" id="stu_username">
    <div class="layui-form-item layui-hide">
        <button class="layui-btn" lay-submit lay-filter="LAY-student-add-submit" id="LAY-student-add-submit">提交</button>
    </div>
</form>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function(){
        var $ = layui.$
            ,form = layui.form ;
        $("#search").click(function(){
            $("#content").empty();
            var stu_username=$("#username").val();
            var data={
                "stu_username":stu_username
            }
            $.ajax({
                url:"{:url('admin/student/getStudentInfoByStudentUsername')}",
                type:"post",
                dataType:"json",
                data:data,
                async:false,
                success:function(res){
                    if(res.code==1){
                        var studentInfo=JSON.parse(res.data);
                        $("#stu_username").val(studentInfo.stu_username);
                        var html='<div id="contentItem">\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">姓名学生</label>\n' +
                            '                <div class="layui-input-block">\n' +
                            '                    <input type="text" name="stu_realname" value="'+studentInfo.stu_realname+'"  autocomplete="off" class="layui-input" readonly>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">学生年级</label>\n' +
                            '                <div class="layui-input-block">\n' +
                            '                    <input type="text" name="stu_realname" value="'+studentInfo.stu_grade+'"   autocomplete="off" class="layui-input" readonly>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">学生学校</label>\n' +
                            '                <div class="layui-input-block">\n' +
                            '                    <input type="text" name="stu_realname" value="'+studentInfo.stu_school+'"  autocomplete="off" class="layui-input" readonly>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '            <div class="layui-form-item">\n' +
                            '                <label class="layui-form-label">注册时间</label>\n' +
                            '                <div class="layui-input-block">\n' +
                            '                    <input type="text" name="stu_realname"  value="'+studentInfo.stu_create_time+'" autocomplete="off" class="layui-input" readonly>\n' +
                            '                </div>\n' +
                            '            </div>\n' +
                            '        </div>';
                        $("#content").append(html);
                    }else{
                        $("#stu_username").val("");
                        layer.msg(res.msg, {icon: 5, time: 1500}, function () {
                        });
                    }
                }
            })
        })
    })

</script>
</body>
</html>
